<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .a1 , 
        .a2 {
            width: 100px;
            height: 100px;
            background-color: #f00;
        }

        .box {
            width: 100px;
            height: 100px;
            position: relative;
            margin: 100px;
        }
        .a2 {
            background-color: #000;
            position: absolute;
            top: 0;
            transform: rotate(90deg);
            transform-origin: -50px 50px;

            transition: 1s;
            color: #fff;
        }

        .box:hover .a2{
            transform: rotate(0);
        }
    </style>
</head>
<body>

    <div class="box">
        <div class="a1"></div>
        <div class="a2">111</div>
    </div>
    
</body>
</html>